package cn.codingtalk.tacomallinterfaceportal.controller;

/**
 * @program: tacomall
 * @package: cn.codingtalk.tacomallinterfaceportal.controller
 * @description: 会员模块
 * @author: 码上talk|RC
 * @create: 2020-03-15 21:39
 **/

import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import cn.codingtalk.tacomallcommon.vo.ResponseVo;
import cn.codingtalk.tacomallcommon.util.RequestUtil;
import cn.codingtalk.tacomallinterfaceportal.service.MemberService;

@Api("会员模块")
@RestController
@RequestMapping("/")
public class MemberController {

    @Autowired
    private MemberService memberService;

    /**
     * @Description:  会员登录
     * @Param:  RequestBody
     * @return:  ResponseVo
     * @Author: 码上talk|RC
     * @Date: 2020/3/25
     */
    @ApiOperation("会员登录")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "requestUtil", value = "request json", dataType = "json"),
    })
    @PostMapping("member/login")
    public String memberLogin(@RequestBody RequestUtil requestUtil) {
        return "hello memberLogin";
    }

    /**
    * @Description:  会员信息
    * @Param:  RequestBody
    * @return:  ResponseVo
    * @Author: 码上talk|RC
    * @Date: 2020/3/25
    */
    @ApiOperation("会员信息")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "requestUtil", value = "request json", dataType = "json"),
    })
    @PostMapping("member/info")
    public ResponseVo findById(@RequestBody RequestUtil requestUtil) throws Exception {
        int id = requestUtil.getInt("id");
        System.out.println(id);
        return memberService.findById(id);
    }
}
